#define _CRT_SECURE_NO_WARNINGS 1
#include "Date.h"


Date::Date(int year, int month, int day)
{
	cout << "Date()" << endl;
	_year = year;
	_month = month;
	_day = day;
}

void Date::Print()
{
	cout<< this->_year << "/" << this->_month << "/" << this->_day<<endl;
}

////Date::~Date()
//{
//cout << "~Date()" << endl;
//}

Date& Date::operator=(const Date& d)
{
	if (this != &d)
	{
		_year = d._year;
		_month = d._month;
		_day = d._day;
	}
	return *this;
}

Date::Date(const Date& d)
{
	_day = d._day;
	_month = d._month;
	_year = d._year;
}

Date& Date::operator++()
{
	_day++;
	return *this;
}

Date Date::operator++(int)
{
	Date tmp(*this);
	_day+=1;
	return tmp;
}

int Date::GetMonthDay(int year, int month)
{
	int days[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
	int day = days[month];
	if (month == 2)
	{
		if ((year % 4 == 0 && year % 10 != 0) || year % 400 == 0)
		{
			day+=1;
		}
	}
	return day;
}

